const express = require("express");

const cors = require("cors");

const app = express();

app.use(express.json());

// app.use((req, res, next) => {
//   res.header("Access-Control-Allow-Origin", "*");
//   next();
// });

app.use(cors());

app.get("/users", (req, res) => {
  res.send({ name: "jack", age: 20 });
});

app.put("/users/:id", (req, res) => {
  res.send({
    params: req.params,
    body: req.body,
  });
});

app.listen(3008, () => {
  console.log("http://127.0.0.1:3008");
});
